﻿@model NK.Mvc3.Models.SaleDetail
           @*<div > test</div>*@
           
@{
    string barcode=string.Empty, pos=string.Empty;
    if (Model!=null)
    {
        barcode = Model.ProductInfo == null ? string.Empty : Model.ProductInfo.BarCode;
        pos = Model.ProductInfo == null ? string.Empty : Model.ProductInfo.POSDescription;
    }
}
<tr @if (Model!=null) {
    @:id="row-@Model.ID"
    }
    else
    {
        @:id="newEmptyRow"
    } >
    <td>
        @Html.TextBox("BarCode", null, new { @class = "grid-textbox-text", Value = barcode })
        @Html.ValidationMessage("BarCode")
        @Html.HiddenFor(model => model.SaleID, new { Value = Model == null ? ViewBag.SaleID : Model.SaleID })
        @Html.ValidationMessageFor(model => model.SaleID)
        @Html.HiddenFor(model => model.ProductInfoID)
        @Html.ValidationMessageFor(model => model.ProductInfoID)
    </td>
    <td>
        @Html.TextBox("POSDesctiption", null, new { @class = "grid-textbox-text", disabled = "disabled", Value = pos })
        @Html.ValidationMessage("POSDesctiption")
    </td>
    <td>
        @Html.TextBoxFor(model => model.Quantity, new { @class = "grid-textbox-text" })
        @Html.ValidationMessageFor(model => model.Quantity)
    </td>
    <td>
        @*@Html.TextBoxFor(model => model.CostSale, new { @class = "grid-textbox-text" })*@
        @Html.TextBoxFor(model => model.CostSale, new { @class = "grid-textbox-text" })
        @Html.ValidationMessageFor(model => model.CostSale)
    </td>
    <td>
        @Html.TextBoxFor(model => model.TotalCost, new { @class = "grid-textbox-text" })
        @Html.ValidationMessageFor(model => model.TotalCost)
    </td>
    <td>
@if (ViewContext.RouteData.Values["Action"].ToString() == "Edit")
{
        <button class="editRow">Save</button><button class="cancelEditRow">Cancel</button>
}
else
{
        <button class="createRow">Create</button><button class="cancelCreateRow">Cancel</button>
}
    </td>
</tr>
